<?php

namespace YouBaoLian\Application\Info;

class CoverageList extends InfoList
{

    public function append(
        string $coverageCode,
        float  $insuredAmount,
        int    $deductionRate = 0,
        int    $unitAmount = 0,
        array  $extra = [
            'serviceNum' => 0,
            'subsidiary' => '',
        ],
        array  $chargingPostCoverageExtList = [])
    {
        $data = [
            'insuredAmount' => $insuredAmount,
            'deductionRate' => $deductionRate,
            'coverageCode' => $coverageCode,
            'unitAmount' => $unitAmount
        ];

        if ($extra) {
            $data = array_merge($data, $extra);
        }

        if ($chargingPostCoverageExtList) {
            $data = array_merge($data, $chargingPostCoverageExtList);
        }
        $this->list[] = $data;
    }

}
